Writing a basic C Shell - understanding argv[] [on hold]

Posted by Flame on Programmers See other posts from Programmers or by Flame
Published on 2013-11-10T22:41:34Z Indexed on 2013/11/11 4:11 UTC
Read the original article Hit count: 195

Filed under:
|

I have an assignment for my class to write a basic C Shell. I have found many pages that explain parts of it and some fully implemented code. I'm not going to copy, i'm just using it right now as a way to get started.

So I'm at the beginning of this project obviously. One example I am looking at parses the user's input and stores a pointer to the beginning of the argument in char *argv[3];

Am I just misunderstanding this or would this technically break if there are more than 3 arguments? (say /a.out arg1 arg2 arg3 etc). Would I wanna malloc this somehow?

I know a.out is considered argv[0], and the arguments argv1 - however many there are. It's probably bad practice to have too many arguments for a program, but I still would at least want to address it as I don't know what my TA's are going to use to test my shell.

© Programmers or respective owner

Related posts about c

    Related posts about shell